home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Setup / BCB / data.z / rassapi.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-09  |  10.5 KB  |  396 lines

  1. /******************************************************************\
  2. *                     Microsoft Windows NT                         *
  3. *               Copyright(c) Microsoft Corp., 1992-1996            *
  4. \******************************************************************/
  5.  
  6. /*++
  7.  
  8. Module Name:
  9.  
  10.     RASSAPI.H
  11.  
  12. Description:
  13.  
  14.     This file contains the RASADMIN structures, defines and
  15.     function prototypes for the following APIs and they can
  16.     be imported from RASSAPI.DLL:
  17.  
  18.      RasAdminServerGetInfo
  19.      RasAdminGetUserAccountServer
  20.      RasAdminUserSetInfo
  21.      RasAdminUserGetInfo
  22.      RasAdminPortEnum
  23.      RasAdminPortGetInfo
  24.      RasAdminPortClearStatistics
  25.      RasAdminPortDisconnect
  26.      RasAdminFreeBuffer
  27.  
  28. Note:
  29.  
  30.     This header file and the sources containing the APIs will work
  31.     only with UNICODE strings.
  32.  
  33. --*/
  34.  
  35. /*
  36.  *      C/C++ Run Time Library - Version 9.0
  37.  *
  38.  *      Copyright (c) 1997, 1998 by Borland International
  39.  *      All Rights Reserved.
  40.  *
  41.  */
  42.  
  43. #ifndef _RASSAPI_H_
  44. #define _RASSAPI_H_
  45. #pragma option push -b
  46.  
  47.  
  48. #ifndef UNLEN
  49.  
  50. #include <lmcons.h>
  51.  
  52. #endif
  53.  
  54. #define RASSAPI_MAX_PHONENUMBER_SIZE     128
  55. #define RASSAPI_MAX_MEDIA_NAME             16
  56. #define RASSAPI_MAX_PORT_NAME                16
  57. #define RASSAPI_MAX_DEVICE_NAME          128
  58. #define RASSAPI_MAX_DEVICETYPE_NAME       16
  59. #define RASSAPI_MAX_PARAM_KEY_SIZE        32
  60.  
  61. // Bits indicating user's Remote Access privileges and mask to isolate
  62. // call back privilege.
  63. //
  64. // Note: Bit 0 MUST represent NoCallback due to a quirk of the "userparms"
  65. //       storage method.  When a new LAN Manager user is created, bit 0 of the
  66. //       userparms field is set to 1 and all other bits are 0.  These bits are
  67. //       arranged so this "no Dial-In info" state maps to the "default Dial-In
  68. //       privilege" state.
  69.  
  70. #define RASPRIV_NoCallback        0x01
  71. #define RASPRIV_AdminSetCallback  0x02
  72. #define RASPRIV_CallerSetCallback 0x04
  73. #define RASPRIV_DialinPrivilege   0x08
  74.  
  75. #define RASPRIV_CallbackType (RASPRIV_AdminSetCallback \
  76.                               | RASPRIV_CallerSetCallback \
  77.                               | RASPRIV_NoCallback)
  78.  
  79. //
  80. // Modem condition codes
  81. //
  82. #define    RAS_MODEM_OPERATIONAL         1    // No modem errors.
  83. #define    RAS_MODEM_NOT_RESPONDING     2
  84. #define    RAS_MODEM_HARDWARE_FAILURE   3
  85. #define    RAS_MODEM_INCORRECT_RESPONSE 4
  86. #define    RAS_MODEM_UNKNOWN             5
  87. //
  88. // Line condition codes
  89. //
  90. #define    RAS_PORT_NON_OPERATIONAL 1
  91. #define    RAS_PORT_DISCONNECTED     2
  92. #define    RAS_PORT_CALLING_BACK    3
  93. #define    RAS_PORT_LISTENING        4
  94. #define    RAS_PORT_AUTHENTICATING  5
  95. #define    RAS_PORT_AUTHENTICATED     6
  96. #define    RAS_PORT_INITIALIZING     7
  97.  
  98. // The following three structures are same as the ones
  99. // defined in rasman.h and have been renamed to prevent
  100. // redefinitions when both header files are included.
  101.  
  102. enum RAS_PARAMS_FORMAT {
  103.  
  104.     ParamNumber        = 0,
  105.  
  106.     ParamString        = 1
  107.  
  108. } ;
  109. typedef enum RAS_PARAMS_FORMAT    RAS_PARAMS_FORMAT ;
  110.  
  111. union RAS_PARAMS_VALUE {
  112.  
  113.     DWORD    Number ;
  114.  
  115.     struct    {
  116.         DWORD    Length ;
  117.         PCHAR    Data ;
  118.         } String ;
  119. } ;
  120. typedef union RAS_PARAMS_VALUE    RAS_PARAMS_VALUE ;
  121.  
  122. struct RAS_PARAMETERS {
  123.  
  124.     CHAR    P_Key    [RASSAPI_MAX_PARAM_KEY_SIZE] ;
  125.  
  126.     RAS_PARAMS_FORMAT    P_Type ;
  127.  
  128.     BYTE    P_Attributes ;
  129.  
  130.     RAS_PARAMS_VALUE    P_Value ;
  131.  
  132. } ;
  133. typedef struct RAS_PARAMETERS    RAS_PARAMETERS ;
  134.  
  135. // structures used by the RASADMIN APIs
  136.  
  137. typedef struct _RAS_USER_0
  138. {
  139.     BYTE bfPrivilege;
  140.     WCHAR szPhoneNumber[ RASSAPI_MAX_PHONENUMBER_SIZE + 1];
  141. } RAS_USER_0, *PRAS_USER_0;
  142.  
  143. typedef struct _RAS_PORT_0
  144. {
  145.     WCHAR wszPortName[RASSAPI_MAX_PORT_NAME];
  146.     WCHAR wszDeviceType[RASSAPI_MAX_DEVICETYPE_NAME];
  147.     WCHAR wszDeviceName[RASSAPI_MAX_DEVICE_NAME];
  148.     WCHAR wszMediaName[RASSAPI_MAX_MEDIA_NAME];
  149.     DWORD reserved;
  150.     DWORD Flags;
  151.     WCHAR wszUserName[UNLEN + 1];
  152.     WCHAR wszComputer[NETBIOS_NAME_LEN];
  153.     DWORD dwStartSessionTime;          // seconds from 1/1/1970
  154.     WCHAR wszLogonDomain[DNLEN + 1];
  155.     BOOL fAdvancedServer;
  156. } RAS_PORT_0, *PRAS_PORT_0;
  157.  
  158.  
  159. // Possible values for MediaId
  160.  
  161. #define MEDIA_UNKNOWN       0
  162. #define MEDIA_SERIAL        1
  163. #define MEDIA_RAS10_SERIAL  2
  164. #define MEDIA_X25           3
  165. #define MEDIA_ISDN          4
  166.  
  167.  
  168. // Possible bits set in Flags field
  169.  
  170. #define USER_AUTHENTICATED    0x0001
  171. #define MESSENGER_PRESENT     0x0002
  172. #define PPP_CLIENT            0x0004
  173. #define GATEWAY_ACTIVE        0x0008
  174. #define REMOTE_LISTEN         0x0010
  175. #define PORT_MULTILINKED      0x0020
  176.  
  177.  
  178. typedef ULONG IPADDR;
  179.  
  180. // The following PPP structures are same as the ones
  181. // defined in rasppp.h and have been renamed to prevent
  182. // redefinitions when both header files are included
  183. // in a module.
  184.  
  185. /* Maximum length of address string, e.g. "255.255.255.255" for IP.
  186. */
  187. #define RAS_IPADDRESSLEN  15
  188. #define RAS_IPXADDRESSLEN 22
  189. #define RAS_ATADDRESSLEN  32
  190.  
  191. typedef struct _RAS_PPP_NBFCP_RESULT
  192. {
  193.     DWORD dwError;
  194.     DWORD dwNetBiosError;
  195.     CHAR  szName[ NETBIOS_NAME_LEN + 1 ];
  196.     WCHAR wszWksta[ NETBIOS_NAME_LEN + 1 ];
  197. } RAS_PPP_NBFCP_RESULT;
  198.  
  199. typedef struct _RAS_PPP_IPCP_RESULT
  200. {
  201.     DWORD dwError;
  202.     WCHAR wszAddress[ RAS_IPADDRESSLEN + 1 ];
  203. } RAS_PPP_IPCP_RESULT;
  204.  
  205. typedef struct _RAS_PPP_IPXCP_RESULT
  206. {
  207.     DWORD dwError;
  208.     WCHAR wszAddress[ RAS_IPXADDRESSLEN + 1 ];
  209. } RAS_PPP_IPXCP_RESULT;
  210.  
  211. typedef struct _RAS_PPP_ATCP_RESULT
  212. {
  213.     DWORD dwError;
  214.     WCHAR wszAddress[ RAS_ATADDRESSLEN + 1 ];
  215. } RAS_PPP_ATCP_RESULT;
  216.  
  217. typedef struct _RAS_PPP_PROJECTION_RESULT
  218. {
  219.     RAS_PPP_NBFCP_RESULT nbf;
  220.     RAS_PPP_IPCP_RESULT  ip;
  221.     RAS_PPP_IPXCP_RESULT ipx;
  222.     RAS_PPP_ATCP_RESULT  at;
  223. } RAS_PPP_PROJECTION_RESULT;
  224.  
  225. typedef struct _RAS_PORT_1
  226. {
  227.     RAS_PORT_0                 rasport0;
  228.     DWORD                      LineCondition;
  229.     DWORD                      HardwareCondition;
  230.     DWORD                      LineSpeed;        // in bits/second
  231.     WORD                       NumStatistics;
  232.     WORD                       NumMediaParms;
  233.     DWORD                      SizeMediaParms;
  234.     RAS_PPP_PROJECTION_RESULT  ProjResult;
  235. } RAS_PORT_1, *PRAS_PORT_1;
  236.  
  237. typedef struct _RAS_PORT_STATISTICS
  238. {
  239.     // The connection statistics are followed by port statistics
  240.     // A connection is across multiple ports.
  241.     DWORD   dwBytesXmited;
  242.     DWORD   dwBytesRcved;
  243.     DWORD   dwFramesXmited;
  244.     DWORD   dwFramesRcved;
  245.     DWORD   dwCrcErr;
  246.     DWORD   dwTimeoutErr;
  247.     DWORD   dwAlignmentErr;
  248.     DWORD   dwHardwareOverrunErr;
  249.     DWORD   dwFramingErr;
  250.     DWORD   dwBufferOverrunErr;
  251.     DWORD   dwBytesXmitedUncompressed;
  252.     DWORD   dwBytesRcvedUncompressed;
  253.     DWORD   dwBytesXmitedCompressed;
  254.     DWORD   dwBytesRcvedCompressed;
  255.  
  256.     // the following are the port statistics
  257.     DWORD   dwPortBytesXmited;
  258.     DWORD   dwPortBytesRcved;
  259.     DWORD   dwPortFramesXmited;
  260.     DWORD   dwPortFramesRcved;
  261.     DWORD   dwPortCrcErr;
  262.     DWORD   dwPortTimeoutErr;
  263.     DWORD   dwPortAlignmentErr;
  264.     DWORD   dwPortHardwareOverrunErr;
  265.     DWORD   dwPortFramingErr;
  266.     DWORD   dwPortBufferOverrunErr;
  267.     DWORD   dwPortBytesXmitedUncompressed;
  268.     DWORD   dwPortBytesRcvedUncompressed;
  269.     DWORD   dwPortBytesXmitedCompressed;
  270.     DWORD   dwPortBytesRcvedCompressed;
  271.  
  272. } RAS_PORT_STATISTICS, *PRAS_PORT_STATISTICS;
  273.  
  274. //
  275. // Server version numbers
  276. //
  277. #define RASDOWNLEVEL       10    // identifies a LM RAS 1.0 server
  278. #define RASADMIN_35        35    // Identifies a NT RAS 3.5 server or client
  279. #define RASADMIN_CURRENT   40    // Identifies a NT RAS 4.0 server or client
  280.  
  281.  
  282. typedef struct _RAS_SERVER_0
  283. {
  284.     WORD TotalPorts;             // Total ports configured on the server
  285.     WORD PortsInUse;             // Ports currently in use by remote clients
  286.     DWORD RasVersion;            // version of RAS server
  287. } RAS_SERVER_0, *PRAS_SERVER_0;
  288.  
  289.  
  290. //
  291. // function prototypes
  292. //
  293.  
  294. DWORD APIENTRY RasAdminServerGetInfo(
  295.     IN const WCHAR *  lpszServer,
  296.     OUT PRAS_SERVER_0 pRasServer0
  297.     );
  298.  
  299. DWORD APIENTRY RasAdminGetUserAccountServer(
  300.     IN const WCHAR * lpszDomain,
  301.     IN const WCHAR * lpszServer,
  302.     OUT LPWSTR       lpszUserAccountServer
  303.     );
  304.  
  305. DWORD APIENTRY RasAdminUserGetInfo(
  306.     IN const WCHAR   * lpszUserAccountServer,
  307.     IN const WCHAR   * lpszUser,
  308.     OUT PRAS_USER_0    pRasUser0
  309.     );
  310.  
  311. DWORD APIENTRY RasAdminUserSetInfo(
  312.     IN const WCHAR       * lpszUserAccountServer,
  313.     IN const WCHAR       * lpszUser,
  314.     IN const PRAS_USER_0   pRasUser0
  315.     );
  316.  
  317. DWORD APIENTRY RasAdminPortEnum(
  318.     IN  const WCHAR * lpszServer,
  319.     OUT PRAS_PORT_0 * ppRasPort0,
  320.     OUT WORD *        pcEntriesRead
  321.     );
  322.  
  323. DWORD APIENTRY RasAdminPortGetInfo(
  324.     IN const WCHAR *            lpszServer,
  325.     IN const WCHAR *            lpszPort,
  326.     OUT RAS_PORT_1 *            pRasPort1,
  327.     OUT RAS_PORT_STATISTICS *   pRasStats,
  328.     OUT RAS_PARAMETERS **       ppRasParams
  329.     );
  330.  
  331. DWORD APIENTRY RasAdminPortClearStatistics(
  332.     IN const WCHAR * lpszServer,
  333.     IN const WCHAR * lpszPort
  334.     );
  335.  
  336. DWORD APIENTRY RasAdminPortDisconnect(
  337.     IN const WCHAR * lpszServer,
  338.     IN const WCHAR * lpszPort
  339.     );
  340.  
  341. DWORD APIENTRY RasAdminFreeBuffer(
  342.     PVOID Pointer
  343.     );
  344.  
  345. DWORD APIENTRY RasAdminGetErrorString(
  346.     IN  UINT    ResourceId,
  347.     OUT WCHAR * lpszString,
  348.     IN  DWORD   InBufSize );
  349.  
  350. BOOL APIENTRY RasAdminAcceptNewConnection (
  351.     IN         RAS_PORT_1 *              pRasPort1,
  352.     IN      RAS_PORT_STATISTICS *   pRasStats,
  353.     IN      RAS_PARAMETERS *        pRasParams
  354.     );
  355.  
  356. VOID APIENTRY RasAdminConnectionHangupNotification (
  357.     IN         RAS_PORT_1 *              pRasPort1,
  358.     IN      RAS_PORT_STATISTICS *   pRasStats,
  359.     IN      RAS_PARAMETERS *        pRasParams
  360.     );
  361.  
  362. DWORD APIENTRY RasAdminGetIpAddressForUser (
  363.     IN         WCHAR  *        lpszUserName,
  364.     IN         WCHAR  *        lpszPortName,
  365.     IN OUT     IPADDR *       pipAddress,
  366.     OUT        BOOL     *    bNotifyRelease
  367.     );
  368.  
  369. VOID APIENTRY RasAdminReleaseIpAddress (
  370.     IN         WCHAR  *        lpszUserName,
  371.     IN         WCHAR  *        lpszPortName,
  372.     IN         IPADDR *       pipAddress
  373.     );
  374.  
  375. // The following two APIs are used to get/set
  376. // RAS user permissions in to a UsrParms buffer
  377. // obtained by a call to NetUserGetInfo.
  378. //
  379. // Note that RasAdminUserGetInfo and RasAdminUserSetInfo
  380. // are the APIs you should be using for getting and
  381. // setting RAS permissions.
  382.  
  383. DWORD APIENTRY RasAdminGetUserParms(
  384.     IN  WCHAR          * lpszParms,
  385.     OUT PRAS_USER_0      pRasUser0
  386.     );
  387.  
  388. DWORD APIENTRY RasAdminSetUserParms(
  389.     IN OUT   WCHAR    * lpszParms,
  390.     IN DWORD          cchNewParms,
  391.     IN PRAS_USER_0    pRasUser0
  392.     );
  393.  
  394. #pragma option pop
  395. #endif // _RASSAPI_H_
  396.